package cn.dubito.miaosha.redis;

/**
 * @author liliang
 * <p>
 * 时间:18/3/29
 **/
public abstract class BasePrefix implements KeyPrefix {

    private int expireSeconds;

    private String prefix;

    BasePrefix(int expireSeconds, String prefix) {
        this.expireSeconds = expireSeconds;
        this.prefix = prefix;
    }

    BasePrefix(String prefix) {
        this(0, prefix);
    }

    @Override
    public int expireSeconds() {
        return expireSeconds;
    }

    @Override
    public String getPrefix() {
        String simpleName = this.getClass().getSimpleName();
        return simpleName + "_" + prefix;
    }
}
